// @ts-ignore
/* eslint-disable */

import { request, type RequestOptions } from '@/utils/request';

/**
 * 添加工单执行人
 * @param data 工单执行人信息
 * @returns
 */
export async function create(data: any, options?: RequestOptions) {
    return request<any>(`workorderexecutor/create`, {
        method: 'POST',
        data: data,
        ...(options || {}),
    });
}

/**
 * 批量添加工单执行人
 * @param data 工单执行人列表
 * @returns
 */
export async function batchCreate(data: any[], options?: RequestOptions) {
    return request<any>(`workorderexecutor/batch-create`, {
        method: 'POST',
        data: data,
        ...(options || {}),
    });
}

/**
 * 获取工单执行人列表
 * @param params 查询参数
 * @returns
 */
export async function list(params: any, options?: RequestOptions) {
    return request<any>(`workorderexecutor/list`, {
        method: 'POST',
        data: params,
        ...(options || {}),
    });
}

/**
 * 根据工单ID获取执行人列表
 * @param workOrderId 工单ID
 * @returns
 */
export async function getByWorkOrderId(workOrderId: string, options?: RequestOptions) {
    return request<any[]>(`workorderexecutor/work-order/${workOrderId}`, {
        method: 'GET',
        ...(options || {}),
    });
}

/**
 * 执行人接受工单
 * @param data 接受工单数据
 * @returns
 */
export async function accept(data: any, options?: RequestOptions) {
    return request<any>(`workorderexecutor/accept`, {
        method: 'POST',
        data: data,
        ...(options || {}),
    });
}

/**
 * 执行人拒绝工单
 * @param data 拒绝工单数据
 * @returns
 */
export async function reject(data: any, options?: RequestOptions) {
    return request<any>(`workorderexecutor/reject`, {
        method: 'POST',
        data: data,
        ...(options || {}),
    });
}

/**
 * 执行人打卡
 * @param data 打卡信息
 * @returns
 */
export async function checkIn(data: any, options?: RequestOptions) {
    return request<any>(`workorderexecutor/check-in`, {
        method: 'POST',
        data: data,
        ...(options || {}),
    });
}

/**
 * 删除工单执行人
 * @param id 执行人记录ID
 * @returns
 */
export async function remove(id: string, options?: RequestOptions) {
    return request<any>(`workorderexecutor/${id}/delete`, {
        method: 'POST',
        ...(options || {}),
    });
}

/**
 * 更新工单执行人信息
 * @param id 执行人记录ID
 * @param data 更新数据
 * @returns
 */
export async function update(id: string, data: any, options?: RequestOptions) {
    return request<any>(`workorderexecutor/${id}/update`, {
        method: 'POST',
        data: data,
        ...(options || {}),
    });
} 